package 考题_K.幸运数字和;

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int k = in.nextInt();
		int count = 0;
		for(int i = 0; i < Math.pow(10, k); i++){
			boolean flag = true;
			char[] data = String.valueOf(i).toCharArray();
			int sum = 0;
			for(int j = 0; j <data.length; j++){
				 sum += data[j]-'0';
				 if(data[j]-'0' != a && data[j]-'0' != b) flag = false;
			}
			if((sum == a || sum == b) && flag) count++;
		}
		System.out.println(count%1000000007);
	}
}
